# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Laurent Bercot <ska-devel@skarnet.org>
pkgname=bcnm
pkgver=0.0.1.8
pkgrel=0
pkgdesc="Better Client Network Manager"
url=https://skarnet.org/software/bcnm/
arch="all"
license="ISC"
options="!check"
_skalibs_version=2.14.3
makedepends="skalibs-dev>=$_skalibs_version linux-headers"
subpackages="$pkgname-static $pkgname-libs $pkgname-dev $pkgname-doc"
source="https://skarnet.org/software/bcnm/bcnm-$pkgver.tar.gz bcnm.pc.in wpactrl.pc.in"

build() {
	./configure \
		--enable-shared \
		--disable-allstatic \
		--prefix=/usr \
		--libexecdir="/usr/lib/$pkgname"
	make
}

package() {
	make DESTDIR="$pkgdir" install
	sed -e "s/@@VERSION@@/$pkgver/g; s/@@SKALIBS_VERSION@@/${_skalibs_version}/g;" "$srcdir/$pkgname.pc.in" > "$srcdir/$pkgname.pc"
	sed -e "s/@@VERSION@@/$pkgver/g; s/@@SKALIBS_VERSION@@/${_skalibs_version}/g;" "$srcdir/wpactrl.pc.in" > "$srcdir/wpactrl.pc"
	install -D -m 0644 "$srcdir/$pkgname.pc" "$pkgdir/usr/lib/pkgconfig/$pkgname.pc"
	install -D -m 0644 "$srcdir/wpactrl.pc" "$pkgdir/usr/lib/pkgconfig/wpactrl.pc"
	mkdir -p "$pkgdir/usr/share/doc"
	cp -a "$builddir/doc" "$pkgdir/usr/share/doc/$pkgname"
}

sha512sums="
78868ba9f5c58acba1e8283492929164096a9e66ea8fd6fc6b5adb4c81bce78cba96173afb4510daa0e16b79313d0ee9ef790523b062f4ceb181ecdea5973f9a  bcnm-0.0.1.8.tar.gz
168127832b78284e4388fa983ea44612e760ca3b5789a863a4a82adb8a75044e006640711a8426d321bb2995425a8cb8e1fb8f788e6d09e5f7b93e55a457fdb6  bcnm.pc.in
ccc46c7a918328236cc5730710a114d06fb91fa6f023f853df70725581469b5b980dc3a5d20046df26393d21b51b4c87f1588cb5fa6cd065b32801a4dfeebb72  wpactrl.pc.in
"
